<!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- [IC型号/元器件]搜索专享 -->
    <meta name="keywords" content="一号轴承网">
    <meta name="description"
          content="一号轴承网">
    <title>一号轴承网</title>
    <link rel="shortcut icon" href="/img/logo.ico" type="image/x-icon">
    <link href="/abd/common.css" rel="stylesheet" type="text/css">
    <link href="css/bootstrap.min.css?v=3.3.6"
          th:href="@{/css/bootstrap.min.css?v=3.3.6}" rel="stylesheet">
    <link href="/css/font-awesome.css?v=4.4.0"
          th:href="@{/css/font-awesome.css?v=4.4.0}" rel="stylesheet">
    <link href="/css/plugins/bootstrap-table/bootstrap-table.min.css"
          th:href="@{/css/plugins/bootstrap-table/bootstrap-table.min.css}"
          rel="stylesheet">
    <link href="/css/front/style.css" rel="stylesheet" type="text/css">
    <script src="/js/jquery.min.js?v=2.1.4"></script>
    <script src="/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="/js/plugins/validate/messages_zh.min.js"></script>
    <script src="/js/plugins/jsTree/jstree.min.js"></script>
    <script src="/js/plugins/jqTreeGrid/jquery.treegrid.min.js"></script>
    <script src="/js/plugins/jqTreeGrid/jquery.treegrid.extension.js"></script>
    <script src="/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js"></script>
    <script src="/js/plugins/chosen/chosen.jquery.js"></script>
    <script src="/js/plugins/layer/layer.js"></script>
    <!--[if IE 7]>
    <link href="http://www.ic.net.cn/media/css/ui/ie7fix.css" rel="stylesheet" type="text/css"/> <![endif]-->
    <script type="application/javascript">
        var li_ok = '<img src=http://oss.114ic.com/Img/check_right.gif border=0> ';  //用于显示正确时的图标
        var li_err = '<img src=http://oss.114ic.com/Img/check_error.gif border=0> '; //用于显示错误时的图标

        //密码是否为空检测
        function password1(){
            var pwd = $("#pwd").val();
            if (pwd == "" || pwd.length < 6) {
                document.getElementById('pwd_re').innerHTML = li_err;
                return false;
            }
            else {
                document.getElementById('pwd_re').innerHTML = li_ok;
                return true;
            }
        }

        //确认密码检测
        function password2() {
            var pwd = document.getElementById('pwd').value;
            var pwd2 = document.getElementById('pwd2').value;
            if (pwd != pwd2) {
                document.getElementById('pwd2_re').innerHTML = li_err;
                document.getElementById('pwd2_re_m').innerHTML = '<span class=msg>两次密码不一致，请重新填写</span>';
                return false;
            }
            else {
                document.getElementById('pwd2_re').innerHTML = li_ok;
                document.getElementById('pwd2_re_m').innerHTML = '<span class=msg2>填写正确</span>';
                return true;
            }
        }

        //返回密码的强度级别
        function checkStrong(sPW) {
            if (sPW.length < 6)
                return 0;//密码太短
            var Modes = 0;
            for (i = 0; i < sPW.length; i++) {
                //测试每一个字符的类别并统计一共有多少种模式.
                Modes |= CharMode(sPW.charCodeAt(i));
            }
            //	alert(bitTotal(Modes));
            return bitTotal(Modes);
        }
        function showStrongPic() {
            var v = $("#pwd").val();
            var m = checkStrong(v);
            if (m < 2) {
                document.getElementById('lowPic').style.display = "";
                document.getElementById('midPic').style.display = "none";
                document.getElementById('highPic').style.display = "none";
            }
            else if (m == 2) {
                document.getElementById('lowPic').style.display = "none";
                document.getElementById('midPic').style.display = "";
                document.getElementById('highPic').style.display = "none";
            }
            else {
                document.getElementById('lowPic').style.display = "none";
                document.getElementById('midPic').style.display = "none";
                document.getElementById('highPic').style.display = "";
            }
        }
        function resetPassword() {
            if (password1() == false||password2()==false) {
                return false;
            }
            $.ajax({
                url:"/front/resetPassword",
                type:"post",
                data:$('#regform').serialize(),
                dataType:"json",
                success:function (data) {
                    console.log(data);
                    if (data.code == 0) {
                        layer.msg("密码重置成功，请登录!");
                    }
                    else {
                        layer.msg(data.msg);
                        return false;
                    }
                },
                error:function (data) {
                    console.log(data);
                }

            })
        }
    </script>
</head>
<body>
<div class="top">
    <div class="top_m b-r-s">
        <div class="top_l">
            <span>欢迎来到“<a href="/front/index">一号轴承网”</a></span>
            <span th:if="${!isLogin}">
                <a  style="font-size: 15px;color: #ff7300;font-weight:bold;" rel="nofollow" href="/login">登录</a>
                <a  style="font-size: 15px;color: #ff7300;font-weight:bold;" rel="nofollow" href="/front/register">免费注册</a>
            </span>
            <span th:if="${isLogin}">
                <a  style="font-size: 15px;color: #ff7300;font-weight:bold;" rel="nofollow" href="/member/welcome">会员中心</a>
            </span>
        </div>
    </div>
    <span style="float: right;padding-right: 30px;" th:if="${isLogin}">
        <a style="font-size: 15px;color: #ff7300;font-weight:bold;" rel="nofollow" href="/logout">退出</a>
    </span>
</div>
<div th:replace="include::header1">
</div>

<div class="content" style="margin-top: 20px">
    <div class="main w m-b-10">
        <div class="position"><a class="home" href="/front/index">首页</a></div>

    <!--主内容区begin-->
        <div>
            <form method="post" id="regform" action="/sent/resetpassword">
                <input name="sid"  type="hidden" th:value="${sid}"/>
                <table  class="table  table-striped table-hover">
                    <tbody>
                    <tr>
                        <td align="right">密码：</td>
                        <td>
                            <input class="form-control"  name="password" id="pwd" type="password" maxlength="16" onblur="password1()" onkeyup="showStrongPic();" size="20">
                        </td>
                        <td><span class="STYLE1" id="pwd_re">*</span></td>
                        <td>
                            <span id="lowPic" style="display:none">低</span>
                            <span id="midPic" style="display:none">中</span>
                            <span id="highPic" style="display:none">高</span>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">确认密码：</td>
                        <td>
                            <input class="form-control"  name="pwd2" id="pwd2" type="password" maxlength="16" onblur="password2()"
                                   size="20"></td>
                        <td><span class="STYLE1" id="pwd2_re">*</span></td>
                        <td id="pwd2_re_m">请您再填写一次密码</td>
                    </tr>
                    <tr>
                        <td align="right"> 　</td>
                        <td align="left" colspan="3"><input type="button" class="btn btn-success" onclick="resetPassword()"
                                                            value="点击重置密码"></td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>

    </div>

    <div th:replace="include::foot1">
    </div>
    <div th:replace="include::foot2">
    </div>
</div>
</body>
</html>